

#import <Foundation/Foundation.h>
#import "TalkfunSDK.h"
#import "TalkfunSDKLifeLiveConfig.h"
NS_ASSUME_NONNULL_BEGIN
@protocol TalkfunSDKLifeLiveDelegate <NSObject>
@optional
/**@name 进入房间的事件回调
 * - 如果加入成功，code 会是一个正数（code = 0），代表加入房间成功）。
 * - 如果加入失败，code 会是一个负数（code < 0），代表进房失败的错误码。
 *  调用刷新refreshData: 也会重新回调
 *  进房失败的错误码含义请参见[错误码  TalkfunSDK 文件的TalkfunError 枚举
 */
- (void)onEnterRoom:(NSInteger)code result:(TFError*)error;
/** @name 接收别人的聊天事件回调
    详见 TFChatSend.h 中的定义
 */
- (void)onDidReceiveText:(TFChatData*)result;
/** @name 删除聊天事件回调
 */
- (void)onChatDel:(NSString*)uuid;

/** @name 当前用户进入房间触发
     详见 TFMember.h 中的定义
*/
- (void)onMemberJoinMe:(TFMember*)result;
/** @name 其它人进入房间触发
     详见 TFMember.h 中的定义
*/
- (void)onMemberJoinOther:(TFMember*)result;
/** @name 有人退出房间
     详见 TFMember.h 中的定义
*/
- (void)onMemberLeave:(TFMember*)result;
/**
 @name 同时在线人数  (真实人+虚拟人员 的总数)
*/
- (void)onPeakConcurrentUsers:(NSInteger)total;
/** @name 摄像头开启
*/
- (void)onCameraShow;
/** @name 摄像头关闭
*/
- (void)onCameraHide;
/** @name 直播间状态
*/
- (void)onLiveStatus:(TalkfunLiveStatus)status;
/** @name 接收滚动通知事件回调
    详见 TFAnnounceRoll.h 中的定义
 */
- (void)onAnnounceRoll:(TFAnnounceRoll*)result;
/**
 @name 当前用户被踢出房间的事件回调
*/
- (void)onMemberKick;
/**
 @name 推送弹窗广告的事件回调
*/
- (void)onPopupPut:(TFPopupPut*)result;
/**
 @name 修改推送弹窗广告
*/
- (void)onPopupUpt:(NSMutableArray <TFPopupPut *>*)popUpList;
/**
 @name 商品列表的事件回调
       商品状态变更时会实时更新列表
       self.lifeConfig.store.goods 与当前goods 是同一个列表
*/
- (void)onGoodsUpdate:(NSMutableArray <TFgoods *>* )goodsList;
/**
 @name 推送公告的事件回调
*/
- (void)onAnnouncement:(TFAnnouncement*)result;
/**
 @name 接收主播发起签到的事件回调
*/
- (void)onSignNew:(TFSignNew*)result;
/**
 @name 接收主播结束签到的事件回调
*/
- (void)onSignEnd:(TFSignEnd*)result;
/**
  @name 投票开始的事件回调
 */
- (void)onVoteNew:(TFVoteData*)result;
/**
  @name 投票结束的事件回调
 */
- (void)onVotePub:(TFVoteData*)result;
/**
  @name 删除投票的事件回调
 */
- (void)onVoteDel:(TFVoteData*)result;
/**
  @name 接收别人私聊的回调
 */
- (void)onChatPrivate:(TFChatData*)result;
/**
 @name 在线客服列表变更时会实时更新列表
*/
- (void)onCustomerServiceListUpdate:(NSMutableArray <TFMember *>* )list;
/**
 @name 主播回答了问题
*/
- (void)onQuestionReply:(TFQuestionData*)result;
/**
 @name 提问删除
*/
- (void)onQuestionDelete:(TFQuestionData*)result;
/**
 @name 接收别人的提问
*/
- (void)onQuestionAsk:(TFQuestionData*)result;
/**
 @name 提问审核通过
*/
- (void)onQuestionAudit:(TFQuestionData*)result;
/**
 @name 抽奖开始
*/
- (void)onLotteryStart:(TFLotteryStart*)result;
/**
 @name 抽奖结束
*/
- (void)onLotteryStop:(TFLotteryStop*)result;
/**
 @name state
       单体禁言 :YES
    单体解除禁言 :NO
*/
- (void)onChatDisable:(BOOL)state;
/**
 @name  state
        全体禁言:YES
     全体解除禁言:NO
*/
- (void)onChatDisableAll:(BOOL)state;

/**
 @name  监听别人的点赞
*/
- (void)onLikePut:(TFLikeData*)likeData;
/**
 @name  直播间模式切换  视频模式 桌面分享模式 RTC模式
*/
- (void)onLiveModeChange:(TFLiveModeChange*)status;
/**
   @name 广播
*/
- (void)onBroadcast:(TFBroadcast*)result;

/**
    宣传图入口数据更新
 */
-(void)onPopUp:(TFPageConfigGlobalSwitchPopUp*)popUp;

/**
 @name 发布问卷测试
*/
- (void)onExaminationPush:(TFQuestionnairePushResult*)result;
/**
 @name 主播提前-结束作答问卷
*/
- (void)onExaminationEnd:(TFQuestionnaireEndResult*)result;
/**
 @name 实时课件下载开关状态
*/
- (void)onDocumentDownload:(BOOL)enable;
/**
 *  播放状态发生变化时候调用
 **/
- (void)playStatusChange:(TalkfunPlayStatus)status;
/**
 *  视频播放状态改变
 */
- (void)playerLoadStateDidChange:(TalkfunPlayerLoadState)loadState;

/**
 *  防作弊签到
 */
- (void)onPreventCheatingSignInListener:(TFSignLoopPreventCheat*)model;
/**
* @画板载入课件状态
*/
- (void)onLoadCourseware:(BOOL)status;

/**
   福袋推送
*/
- (void)onLuckyBagPush:(TFLuckyBagPublish*)luckyBagInfo;
/**福袋取消 */
- (void)onLuckyBagCance:(TFLuckyBagCance*)luckyBagInfo;
/**福袋获胜  isWinner: 当前用户是否中奖*/
- (void)onLuckyBagWinning:(TFLuckyBagWinning *)luckyBagWinningInfo isWinner:(BOOL)isWinner;
/**福袋通知*/
- (void)onLuckyBagNotice:(TFLuckyBagWinning *)luckyBagWinningInfo;
@end

@interface TalkfunSDKLifeLive : NSObject
/*
* 您可以通过 TalkfunSDKLifeLiveDelegate 获得来自 SDK 的各种状态通知，详见 TalkfunSDKLifeLiveDelegate.h 中的定义
*/
@property (nonatomic, weak) id<TalkfunSDKLifeLiveDelegate> _Nullable delegate;

/*
 音量
 */
@property (nonatomic,assign) CGFloat playVolume;
/*视频显示模式
  默认  TalkfunMovieScalingModeAspectFit
 */
@property (nonatomic,assign) TalkfunMovieScalingMode scalingMode;
/*
 onEnterRoom:result:()回调后, roomInfo的值才准确
   获取生活直播相关配置 lifeConfig
 */
@property (nonatomic,strong)TFLifeRoomInfo * _Nonnull roomInfo;
/**
*  创建 TalkfunSDKLifeLive 单例
*/
+ (instancetype _Nonnull )sharedInstance;
/**
*  销毁 TalkfunSDKLifeLive 单例
*/
- (void)destroy;
/** 进入房间
 *  调用  enterRoom() 接口执行进房操作后，会收到来自 SDK 的 onEnterRoom:result:() 回调：
 * @param param 进房参数，请参考 TFInitParams
*/
- (void)enterRoom:(TalkfunSDKLifeLiveInitParams *)param;
/** 配置摄像头容器 */
- (void)configureCameraContainerView:(UIView *_Nonnull)cameraContainerView;
/** 配置桌面分享容器  视频播放容器*/
- (void)configureDesktopContainerView:(UIView *_Nonnull)desktopContainerView;
/** 配置ppt容器*/
- (void)configurePPTContainerView:(UIView *)pptContainerView;
/** 配置暖场视频容器*/
- (void)configureWarmupContainerView:(UIView *_Nonnull)warmupContainerView;

/**
  发送聊天
  result result = 0 成功），result != 0 时为错误码。
 */
- (void)sendChat:(NSString *)msg
        callback:(void (^__nullable) (NSInteger code,  TFChatData*_Nullable  model ,TFError *_Nullable  error))callback;
/**
  发送私聊客服
  result result = 0 成功），result != 0 时为错误码。
 */
- (void)sendChatPrivate:(NSString *)xid msg:(NSString*_Nonnull)msg
               callback:(void (^__nullable)(NSInteger code , TFChatData *_Nullable model,TFError *_Nullable  error))callback;
/**
  发起提问
 */
- (void)enterAskQuestions:(NSString *)msg
                 callback:(void (^__nullable) (NSInteger code,  TFQuestionData*_Nullable  model ,TFError *_Nullable  error))callback;
/**
 *  获取提问列表
 **/
- (void)getAListOfQuestions:(void (^__nullable) (NSInteger code,  NSMutableArray <TFQuestionData *>*_Nullable  list ,TFError *_Nullable  error))callback;
/**
   刷新SDK
 */
- (void)refreshData;
/**
    获取网络线路组 2.0
 */
- (void)getLineList:(void (^_Nullable)(TFLiveLineManager * _Nonnull result))callback;
/**
       设置线路 2.0
 *      例子
 *     "operatorID" : "telecom"          网络类型
       "selectedSegmentIndex" : 0,   组索引
 **/
- (void)setNetwork:(NSString *)operatorID
selectedSegmentIndex:(NSInteger)selectedSegmentIndex
          callback:(void (^__nullable)(NSInteger code ,TFError *_Nullable  error))callback;
/** 点赞
 */
- (void)likeClick:(void (^__nullable)(NSInteger code , TFLikeData *_Nullable model,TFError *_Nullable error))callback;

/**
   举报主播
 */
- (void)reportingMembers:(NSString*)msg
                callback:(void (^__nullable)(NSInteger code , TFError *_Nullable error))callback;

/**
 *  进入后台时是否暂停音频(默认暂停YES)
 **/
- (void)setPauseInBackground:(BOOL)pause;
/**
 *  暂停
 *
 *  点播或者直播都可以暂停，一般只是用于点播的暂停
 **/
- (void)pause;
/**
 *  播放
 *  在暂停之后的播放调用
 **/
- (void)play;
/**
 *  播放2.0
 *  在暂停之后的播放调用
 **/
-(void)playWithCompletion:(void (^__nullable)(NSInteger code ,TFError *_Nullable  error))callback;
/**
 *  签到
 **/
- (void)signIn:(NSString*)signId
      callback:(void (^__nullable)(NSInteger code , TFError *_Nullable error))callback;
/**
      获取投票列表 2.0
 **/
- (void)getVotingList:(void (^__nullable)(NSInteger code ,NSMutableArray <TFVoteData *>*_Nullable  list ,TFError *_Nullable error))callback;
/**
      获取投票ID详情 2.0
 **/
- (void)getVotingDetails:(NSString*)vid
                callback:(void (^__nullable)(NSInteger code , TFVoteData *_Nullable model,TFError *_Nullable error))callback;
/**
      确认投票 2.0
 **/
- (void)voteSubmit:(TFSubmit*)model
          callback:(void (^__nullable)(NSInteger code , TFError *_Nullable  error))callback;
/**
 *上传图片生成url链接
  如果发送成功，code 会是0        error 等于nill    imageUrl 会有值
  如果发送失败，code 会是!=0    error会有值
 **/
- (void)uploadingpicImg:(UIImage*)image progress:(nullable void (^)(CGFloat  uploadProgress))uploadProgress
               callback:(void (^__nullable)(NSInteger code , NSString *_Nullable model,TFError *_Nullable error))callback;

/**
 获取问卷详情
 **/
- (void)getExaminationDetail:(TTFExaminationDetailParam*)param
                    callback:(void (^__nullable)(NSInteger code ,TFExaminationDetail* _Nonnull result,TFError *_Nullable error))callback;


/**
     填写问卷
 **/
- (void)fillExaminationAnswers:(TFFillExaminationAnswersParam*)model
                      callback:(void (^__nullable)(NSInteger code,TFError *_Nullable error))callback;
/**
     开启画中画 关闭画中画
     默认:关闭状态
 **/
- (void)pictureInPicture:(BOOL)isOpen;
//1.判断是否支持画中画功能
- (BOOL)isPictureInPictureSupported;
/**在线人员列表*/
- (void)getMemberList:(void (^_Nonnull)(NSInteger code ,NSMutableArray <TFMember *>*_Nullable  list ,TFError *_Nullable error))callback;
/**
   获取邀请榜单
 */
- (void)getInvitationList:(void (^_Nonnull)(NSInteger code , TFInvitationListData *_Nullable model,TFError *_Nullable error))callback;
/**创建邀请卡*/
- (void)getInvitationCard:(void (^_Nonnull)(NSInteger code ,TFInvitationCard*_Nullable  model ,TFError *_Nullable error))callback;

/**
 提交信息采集(问卷)表单
 *    姓名
 *    collect : collect_0
 *    value : 12345
 *
 *    手机号验证码 ,
 *    collect : collect_0_check
 *    value : 13800138000
 
 *    示例 ["collect_1": "2", "collect_0": "1", "collect_2_check": "9352", "collect_2": "13800138000"]
 */
- (void)submitQuestionnaire:(NSDictionary*)dict
                   callback:(void (^_Nonnull)(NSInteger code,TFError *_Nullable error))callback;
/**
 获取已填写信息采集(问卷)信息，未填写过信息采集返回空数据
 */
- (void)getFilledQuestionnaire:(void (^_Nonnull)(NSInteger code,TFFilledQuestionnaire * model,TFError *_Nullable error))callback;
/**
 获取  信息采集(问卷)信息 短信验证码
 */
- (void)sendSMSVerificationCode:(NSString*)phone
                       callback:(void (^_Nonnull)(NSInteger code,TFError *_Nullable error))callback;

/**
    防作弊签到
    type | 0: 倒计时结束后发
        1: 继续学习
 */
- (void)preventCheatingSignInType:(NSInteger)type
                         callback:(void (^_Nonnull)(NSInteger code,TFError *_Nullable error))callback;

/**查看福袋详情**/
- (void)getLuckyBag:(NSInteger)ID
           callback:(void (^_Nonnull)(NSInteger code, TFLuckyBag_details *_Nullable model ,TFError *_Nullable  error))callback;
/**福袋中奖列表**/
- (void)getListLuckyBagWinner:(NSInteger)ID
           callback:(void (^_Nonnull)(NSInteger code, TFListLuckyBagWinner *_Nullable model ,TFError *_Nullable  error))callback;
/**参与福袋开奖*/
- (void)participateLuckyBag:(NSInteger)ID callback:(void (^_Nonnull)(NSInteger code,TFError *_Nullable error))callback;
/**领取信息填写*/
- (void)completeLuckyBagReceiveInfo:(NSString*)receiveInfo ID:(NSInteger)ID callback:(void (^_Nonnull)(NSInteger code,TFError *_Nullable error))callback;

@end


NS_ASSUME_NONNULL_END
